See the following sample code:
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 20) {
ForEach(0 ..< 12) { index in
Rectangle()
.foregroundColor(.white)
.frame(width: 100, height: 100, alignment: .center)
.shadow(radius: 20)
}
}
}
This sample code will result in a horizontal scrollview
with rectangles as elements.
However as it seems the ScrollView actually clips its content
so any shadow on the top and bottom will be clipped.
Is there any way to disable automatic clipping by the scrollview
or another way to achieve this?